var _authorize = require("../../utils/authorize");

Component({
    options: {
        addGlobalClass: !0
    },
    data: {
        authName: ""
    },
    methods: {
        show: function(t, e) {
            this.type = t, this.conf = e, this.setData({
                isShown: !0,
                authName: (0, _authorize.getScope)(t).desc
            });
        },
        _hide: function() {
            this.setData({
                isShown: !1
            });
        },
        onConfirm: function() {
            var t = this, e = this.type, i = this.conf;
            this._hide(), (0, _authorize.toOpenSetting)(e).catch(i.fail).then(function() {
                t.triggerEvent("confirm"), void 0 === i.execute ? (0, _authorize.loadApi)(e, i, !0) : delete i.execute;
            });
        },
        onCancel: function() {
            this._hide(), this.triggerEvent("cancel");
        }
    }
});